#!/bin/bash

curl https://download.geonames.org/export/dump/cities1000.zip > cities1000-$(date -Idate).zip
curl https://download.geonames.org/export/dump/admin1CodesASCII.txt > admin1CodesASCII-$(date -Idate).txt
curl https://download.geonames.org/export/dump/admin2Codes.txt > admin2Codes-$(date -Idate).txt

scp cities1000-$(date -Idate).zip admin1CodesASCII-$(date -Idate).txt admin2Codes-$(date -Idate).txt repos.archlinux.org:/srv/ftp/other/packages/koko

sed -e "s|cities1000.*.zip|cities1000-$(date -Idate).zip|g" \
    -e "s|admin1CodesASCII.*.txt|admin1CodesASCII-$(date -Idate).txt|g" \
    -e "s|admin2Codes.*.txt|admin2Codes-$(date -Idate).txt|g" \
    -i PKGBUILD
updpkgsums
